package ocean.data.I;

import java.util.ArrayList;

import ocean.data.DataHolder;
import ocean.service.FloraAndFaunaLocInit;

public abstract class EntityBuilder
{
    public abstract void generate() throws InstantiationException, IllegalAccessException;
    
    protected static void fill(ArrayList res,int i,Class type) throws InstantiationException, IllegalAccessException
    {
	while (i != 0)
	{
	    res.add(type.newInstance());
	    i--;
	}

    }

    protected static void setPositions(ArrayList<? extends IdBuilder> res)
    {
	for (IdBuilder obj : res)
	{
	    obj.setPosition(FloraAndFaunaLocInit.getFreePosition());
	}
    }
    protected static void fillIdObjMatrix(ArrayList<? extends IdBuilder> ff)
    {
	int [][]pos=DataHolder.getPositionsObjMatrix();
	
	for (IdBuilder obj : ff)
	{
	    pos[obj.getPosition().x][obj.getPosition().y]=obj.getId();
	}
	
    }
}
